<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:json="http://www.mulesoft.org/schema/mule/json"
	xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
	xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd">
	<jdbc-ee:mssql-data-source name="MS_SQL_Data_Source"
		user="mule" password="mule"
		url="jdbc:sqlserver://EAL-00186;databaseName=WGRUS-phone"
		transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source" />
	<jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source"
		validateConnections="true" queryTimeout="-1" pollingFrequency="0"
		doc:name="Database" />
	<mulexml:object-to-xml-transformer
		name="Object_to_XML" doc:name="Object to XML" />
	<flow name="CallCenterCostumerEventsPickupFlow" doc:name="CallCenterCostumerEventsPickupFlow">
		<jdbc-ee:inbound-endpoint queryTimeout="-1"
			pollingFrequency="1000" doc:name="Database" connector-ref="Database"
			queryKey="Events">
			<jdbc-ee:query key="Events"
				value="SELECT Id,TelefonNr,Navn,Gade,PostNr,[By],Oprettet,Email,Event FROM dbo.CustomerEvent" />
			 <jdbc-ee:query key="Events.ack"
				value="DELETE FROM dbo.CustomerEvent where Id = #[map-payload:Id] " />
		</jdbc-ee:inbound-endpoint>
        <jdbc-ee:maps-to-xml-transformer doc:name="Maps to XML"/>
        <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" doc:name="XSLT" outputEncoding="UTF-8" xsl-file="src/main/resources/CallCenterCustomerToAccountingCustomer.xsl"/>
        <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
        <jms:outbound-endpoint queue="WGRUS.INCOMMING_CUSTOMER" connector-ref="Active_MQ" doc:name="JMS"/>
	</flow>
</mule>
